package leetcode.day;

// 717. 1比特与2比特字符
public class IsOneBitCharacter {

    public static void main(String[] args) {
        System.out.println(isOneBitCharacter(new int[]{1, 1, 0}));
    }

    public static boolean isOneBitCharacter(int[] bits) {
        int index = bits.length - 2;
        int count = 0;
        while (index >= 0 && bits[index--] == 1) {
            count++;
        }
        if (count % 2 == 0) {
            return true;
        } else {
            return false;
        }
    }
}
